/*--------------------------------------------------------------------------------------*\
**
** castle_window.h
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#pragma warning( disable: 4786 )

#ifndef CASTLE_WINDOW_H_INCLUDED
#define CASTLE_WINDOW_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "bitmap_group_ptr.h"
#include "bitmap_layer_ptr.h"
#include "building_traits.h"
#include "combat_model_window.h"
#include "creature.h"
#include "creature_traits.h"
#include "game_window.h"
#include "skill_icon_ptr.h"

class t_army;
class t_button;
class t_town_window;
class t_toggle_button;
class t_town;
class t_player;
class t_text_window;

class t_castle_window : public t_window
{
public:
	enum 
    { 
        k_num_top_windows       = 3,
        k_max_creature_windows  = 5,
        k_max_total_windows     = 6,
        k_portal_number         = 5,
        k_num_stats             = 6,
		k_max_material_costs	= 3,
    };
    struct t_castle_creature_window
    {
        t_combat_model_window*  anim_window_ptr;
		t_bitmap_layer_window*	cost_icon[k_max_material_costs];
		t_text_window*			cost_text[k_max_material_costs];
    	t_creature_type         creature_type;
	    t_text_window*			creature_num;
	    t_text_window*			creature_growth;
	    t_text_window*			damage;
	    t_text_window*			hit_points;
	    t_text_window*			melee_offense;
	    t_text_window*			melee_defense;
	    t_text_window*			movement;
	    t_text_window*			ranged_offense;
	    t_text_window*			ranged_defense;
	    t_text_window*			shots;
	    t_text_window*			speed;
	    t_skill_icon_ptr        m_skill_icons[4];
    };

	t_castle_window( t_town* town, t_town_window* parent, int discount );

protected:
	t_bitmap_group_ptr		    m_background_bitmaps_ptr;
    t_button *                  m_buttons[k_max_total_windows];
    t_castle_creature_window    m_creature_windows[k_max_total_windows];
	int						    m_current_cost;
	int							m_discount;
	t_bitmap_group_ptr			m_material_icons;
	t_player *			        m_player_ptr;
	int						    m_player_funds;
	t_text_window*				m_material_text[k_material_count];
    int                         m_num_windows;
    bool                        m_show_portal;
    t_town_window *             m_town_window;
	t_town *			        m_town;

    //void create_creature_window( t_castle_creature_window &creature_window, t_creature_type const creature,
    //            int creature_amount, int window_index );
    void create_creature_window( t_screen_rect& creature_rect, t_creature_type creature, 
								 t_town_building building, int creature_amount, 
								 int window_index );
    void update_creature_quantity( t_castle_creature_window &creature_window, t_creature_type const creature_type, int quantity );
    void update_creature_stats( t_castle_creature_window&	creature_window,
								t_creature_type				creature_type,
								t_town_building				building );
    void material_update();
    void recruit_creatures( t_button *button_ptr, int index ); //t_creature_type creature_type);
    void recruit_portal( t_button *button_ptr );
    void purchase_all_click( t_button *button_ptr );
    void close_click( t_button *button_ptr );
};

#endif // CASTLE_WINDOW_H_INCLUDED
